Xbasic

SQL::ResultSetData Method

Syntax

Data as A = Data(Column as N)

Data as A = Data(Column as C)

Arguments

ColumnNumeric Character

The column name or the number of the column. The first column is 1.

Returns

DataAny Type

The value of the specified column in the current row of the result set.

Description

Get the data for the column name or index specified.

Discussion

The Data() method returns the data for the specified column in a SQL::ResultSet.

Example

dim conn as SQL::Connection
dim args as SQL::Arguments
dim sql as C
sql = "select * from customers where country = :country"

args.set("country","Spain")

if .not. conn.open("::Name::AADemo-Northwind")
    ui_msg_box("Error", conn.CallResult.text)
    end
end if

if .not. conn.execute(sql,args)
    ui_msg_box("Error", conn.CallResult.text)
    conn.close()
    end
end if

if (conn.ResultSet.nextRow()) then
    ui_msg_box("SQL::ResultSet Data(3)", "SQL::ResultSet Data() for column 3: " + conn.ResultSet.data(3))
    ui_msg_box("SQL::ResultSet Data('CompanyName')", "SQL::ResultSet Data() for 'CompanyName' column: " + conn.ResultSet.data("CompanyName"))
else
    ' No records retrieved
end if

conn.close()